import re

def update_amazon_sku(smzdm):
    m = re.search(r'(B0[A-Z0-9]{8})', smzdm.remark)
    if m:
        smzdm.commodity_sku = m.group(1)
        smzdm.mall_url = 'https://www.amazon.cn/dp/%s' %m.group(1)
        if smzdm.mall_url: smzdm.active = True
    m = re.search(r'(b0[a-z0-9]{8})', smzdm.remark) # https://www.amazon.cn/gp/product/b00hiy68pc
    if not smzdm.active and m:
        smzdm.commodity_sku = m.group(1)
        smzdm.mall_url = 'https://www.amazon.cn/gp/product/%s' %m.group(1)
        if smzdm.mall_url: smzdm.active = True
    return smzdm
